#include <iostream>
#include <string>
#include <cctype>

using namespace std;

bool judge(const char *a, const char *b)
{
    if (*a == '\0' and *b == '\0')
    {
        return true;
    }

    if (*a == '\0' or *b == '\0')
    {
        return false;
    }

    if (*a == '?')
    {
        if (isalnum(*b))
        {
            return judge(a + 1, b + 1);
        }
        return false;
    }

    if (*a == '*')
    {
        if (isalnum(*b))
        {
            return judge(a + 1, b + 1) or judge(a, b + 1) or judge(a + 1, b);
        }
        return false;
    }

    if (*a == *b)
    {
        return judge(a + 1, b + 1);
    }
    return false;
}

int main()
{
    string a, b;
    cin >> a;
    cin >> b;
    for (auto &x : a)
    {
        if (isupper(x))
        {
            x = x - 'A' + 'a';
        }
    }
    for (auto &x : b)
    {
        if (isupper(x))
        {
            x = x - 'A' + 'a';
        }
    }
    if (judge(a.c_str(), b.c_str()))
    {
        cout << "true";
    }
    else
    {
        cout << "false";
    }
    return 0;
}